package com.ljl.ssm.controller;

import com.ljl.ssm.entity.CompleteIn;

import com.ljl.ssm.service.ICompleteInService;
import com.ljl.ssm.service.IRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@Controller
public class CompleteInController {
    @Autowired
    ICompleteInService completeInService;
    @Autowired
    IRegisterService registerService;
    CompleteIn completeIn;

    //第一次点击查看详情
    @RequestMapping(value ="/person")
    public String completeInfo(HttpServletRequest request,Model model){
        completeIn=completeInService.userInfo(request,model);
        System.out.println("controller层返回的数据:"+completeIn);
        return "self_info";
    }

//进入页面后完善信息
    @RequestMapping(value = "userInfoManage")
    public String editInfo(String password,CompleteIn completeIn,HttpServletRequest request, Model model,MultipartFile pic){
        completeInService.editUserInfo(request,completeIn,pic,model);
        registerService.editPassword(request,password,model);
        return "self_info";
    }

}
